<?php

App::uses('AppModel', 'Model');

/**
 * Project Model
 * 
 * PHP versions 5
 * CAKEPHP versions 2.x
 *
 * @author        TienVanVo <vantienvnn@gmail.com>
 * @link          
 * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
 *
 */
class Content extends AppModel {

	/**
	 * Validation rules.
	 *
	 * @var array
	 */
	public $validate = array(
		'title' => array(
			'notempty' => array(
				'allowEmpty' => false,
				'rule' => 'notempty',
				'message' => 'This field is required',
			),
			'minLength' => array(
				'allowEmpty' => false,
				'rule' => array('minLength', 3),
				'message' => 'Minimum 3 characters allowed',
			)
		),
		'fulltext' => array(
			'notempty' => array(
				'allowEmpty' => false,
				'rule' => 'notempty',
				'message' => 'This field is required',
			)
		)
	);

	public static function fulltext($id) {
		$data = ClassRegistry::init('Content')->findById($id);
		if ($data) {
			return $data['Content']['fulltext'];
		}
		return '';
	}

}

?>